rs4855v 2.2.1
Loading...
Searching...
No Matches
rs4855v


RS485 5V Click

RS485 5V Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Ilic
  • Date : Jun 2021.
  • Type : UART type

Software Support

Example Description

This example reads and processes data from RS485 5V Clicks.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.RS4855V

Example Key Functions

  • rs4855v_cfg_setup Config Object Initialization function.
    void rs4855v_cfg_setup(rs4855v_cfg_t *cfg)
    RS485 5V configuration object setup function.
    RS485 5V Click configuration object.
    Definition rs4855v.h:126
  • rs4855v_init Initialization function.
    err_t rs4855v_init ( rs4855v_t *ctx, rs4855v_cfg_t *cfg );
    err_t rs4855v_init(rs4855v_t *ctx, rs4855v_cfg_t *cfg)
    RS485 5V initialization function.
    RS485 5V Click context object.
    Definition rs4855v.h:105
  • rs4855v_generic_read This function reads a desired number of data bytes by using UART serial interface.
    err_t rs4855v_generic_read ( rs4855v_t *ctx, char *data_buf, uint16_t max_len );
    err_t rs4855v_generic_read(rs4855v_t *ctx, char *data_buf, uint16_t max_len)
    RS485 5V data reading function.
  • rs4855v_send_command This function sends a command by using UART serial interface.
    void rs4855v_send_command ( rs4855v_t *ctx, char *command );
    void rs4855v_send_command(rs4855v_t *ctx, char *command)
    Send command.

Application Init

Initializes driver and wake-up module.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
// Click initialization.
rs4855v_init( &rs4855v, &cfg );
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
#ifdef DEMO_APP_TRANSMITTER
log_printf( &logger, "------------------\r\n" );
log_printf( &logger, " Send data: \r\n" );
log_printf( &logger, " MikroE \r\n" );
log_printf( &logger, "------------------\r\n" );
log_printf( &logger, " Transmit data \r\n" );
Delay_ms ( 1000 );
#endif
#ifdef DEMO_APP_RECEIVER
log_printf( &logger, "------------------\r\n" );
log_printf( &logger, " Receive data \r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
#endif
log_printf( &logger, "------------------\r\n" );
}
#define RS4855V_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition rs4855v.h:92
void application_init(void)
Definition main.c:96
#define MIKROBUS_POSITION_RS4855V
Definition main.c:30

Application Task

Reads the received data and parses it.

void application_task ( void )
{
#ifdef DEMO_APP_RECEIVER
rs4855v_process( );
if ( current_rsp_buf > 0 ) {
log_printf( &logger, "%s", current_rsp_buf );
rs4855v_clear_current_rsp_buf( );
}
#endif
#ifdef DEMO_APP_TRANSMITTER
rs4855v_send_command( &rs4855v, &demo_message[ 0 ] );
log_printf( &logger, "\t%s", &demo_message[ 0 ] );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "------------------\r\n" );
#endif
}
unsigned char demo_message[9]
Definition main.c:48
void application_task(void)
Definition main.c:141

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.